//
//  MessageDetailViewController.m
//  LubanWork
//
//  Created by xiaohao on 2020/1/2.
//  Copyright © 2020 xiaohao. All rights reserved.
//

#import "MessageDetailViewController.h"
#import "MessageDetailTableViewCell.h"
#import "GotoLoginView.h"
@interface MessageDetailViewController ()<UITableViewDelegate,UITableViewDataSource>
@property(nonatomic,strong) UITableView * table;
@end

@implementation MessageDetailViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.title = @"消息详情";
    [self setTable];
}
-(UITableView *)table{
    if (!_table) {
        _table = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, WIDTH, HEIGHT-kTabHeight) style:UITableViewStylePlain];
        _table.delegate = self;
        _table.dataSource = self;
        self.table.backgroundColor = kColorFromRGB(248, 249, 255);
        _table.separatorStyle = UITableViewCellSeparatorStyleNone;
        
    }
    return _table;
}


- (void)setExtraCellLineHidden:(UITableView *)tab{
    UIView *view = [UIView new];
    //    view.backgroundColor = [UIColor clearColor];
    [tab setTableFooterView:view];
}
-( void)setTable{
    [self setExtraCellLineHidden:self.table];
    [self.table setSeparatorInset:UIEdgeInsetsZero];
    [self.view addSubview:self.table];
    
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return 1;
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    MessageDetailTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cell"];
    
    if (!cell ) {
        cell = [[MessageDetailTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"cell"];
    }
    cell.messageView.jobPriceLabel.text = [self.NextModel.wagemax stringValue];
    [cell.messageView.jobButton addTarget:self action:@selector(click) forControlEvents:UIControlEventTouchUpInside];
    [cell.headerImageView sd_setImageWithURL:[NSURL URLWithString:self.NextModel.companyImage] placeholderImage:[UIImage imageNamed:@"userHeaderImg"]];
    
    NSString *str1 = [self.NextModel.wagetype isEqualToNumber:@1] == YES ? @"日结":@"月结";
    
    NSString *str2 = [self.NextModel.jobtime isEqualToNumber:@1] == YES ? @"长期":@"短期";
    NSString *str3;
    if ([self.NextModel.sex isEqualToNumber:@1]) {
        str3 = @"男";
    }else if ([self.NextModel.sex isEqualToNumber:@2]){
        str3 = @"女";
    }else{
        str3 = @"男女不限";
    }
    
    cell.messageView.jodDetailLabel.text = [NSString stringWithFormat:@"%@ | %@ | %@",str1,str2,str3];
    
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    return cell;
}

-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    return KSCHEIGHT(227);
}
-(void)click{
    GotoLoginView *gologin = [[GotoLoginView alloc] init];
    gologin.weChatLab.text = self.NextModel.companyWx;
    [gologin show];
}

@end
